from db.connection_pool import ConnectionPool

with ConnectionPool() as db:
    sql = 'select * from users'
    try:
        # 获取所有记录列表
        db.cursor.execute(sql)
        results = db.cursor.fetchall();
        for row in results:
            # 打印结果
            print("userId=%d,name=%s,password=%s" %
                  (row[0], row[1], row[2]))
    except:
        print("Error: unable to fecth data")
